package library;

import java.util.Set;

import library.item.LibraryItem;

public interface Library<T extends LibraryItem> {

	/**
	 * Adds a {@link LibraryItem} to the library. Existing entries (with
	 * identical identifier) will not be added again.
	 * 
	 * @param e the LibraryItem to be inserted to the database
	 * @return true if adding was successfull, otherwise false
	 */
	public boolean addEntry(T e);

	/**
	 * Removes a given {@link LibraryItem} from the library if it exists.
	 * 
	 * @param id identifier of the LibraryItem to be deleted
	 * @return true if deleting was successfully, otherwise false
	 */
	public boolean deleteEntry(String id);

	/**
	 * Removes everything from the library.
	 * 
	 * @return true if removal was successfull, otherwise false
	 */
	public boolean emptyLibrary();

	/**
	 * Returns the element with the given identifier or null if no item with
	 * this identifier is present in the library. 
	 * 
	 * @param id the identifier of the {@link LibraryItem} to search for
	 * @return the LibraryItem object with the given id, if any, otherwise null
	 */
	public T getEntry(String id);

	/**
	 * Returns the identifiers of all elements in the library.
	 * 
	 * @return the set of (String) identifiers of all elements in the library
	 */
	public Set<String> getIdentifiers();

	/**
	 * Returns the size of the library.
	 * 
	 * @return the size of the libraray
	 */
	public int getSize();
}
